﻿using System.ComponentModel;
using System;

namespace Elifart.Library.Utils
{
    public class ChangesNotifier<T> : INotifyPropertyChanged
    {
        #region Constructor

        internal ChangesNotifier(T objectModel)
        {
            this.ObjectModel = objectModel;
        }

        #endregion

        #region Attributes and Properties

        private T _objectModel;
        public T ObjectModel
        {
            get { return this._objectModel; }
            set { this._objectModel = value; }
        }

        #endregion

        #region Events

        public event PropertyChangedEventHandler PropertyChanged;

        #endregion

        #region Private Methods

        internal void RaisePropertyChanged(string propertyName)
        {
            if (this.PropertyChanged != null)
                this.PropertyChanged(this.ObjectModel, new PropertyChangedEventArgs(propertyName));
        }

        #endregion
    }
}
